﻿export default class apiDataModel<T> {
  //#region code
  private _code: number

  public get code() {
    return this._code
  }

  public set code(code: number) {
    this._code = code
  }
  //#endregion

  //#region message
  private _message: string

  public get message() {
    if (this._message == null || this._message == "") {
      return this.msg
    } else {
      return this._message
    }
  }

  public set message(message: string) {
    this._message = message
  }
  //#endregion

  //#region msg
  private _msg: string = ""

  public get msg() {
    return this._msg
  }

  public set msg(msg: string) {
    this._msg = msg
  }
  //endregion

  public get success() {
    return this.code == 0
  }

  //#region data
  private _data: T

  public get data() {
    return this._data
  }

  public set data(data: T) {
    this._data = data
  }
  //#endregion
}
